/*
 * vide.java
 * 
 * last update: 01.02.2010 by Stefan Saru
 * 
 * author:	Lucian Ghita Felix(felix@ulise.cs.pub.ro)
 *
 * Obs: N/A
 */

package ide;


import javax.swing.*;


/**
 * vide IDE launcher class
 *
 * @version 1.0 03/25/98
 * @author 
 */
public class vide {

	/**
	 * this should be set to the base installation dir
	 */
	public static String baseDir;

	static {
		/*if (System.getProperty("vide.home") == null) {
			throw new RuntimeException("environment variabile \"VIDE_HOME\" not set. Please check up the README file.");
		}
		System.out.println("user.dir = " + System.getProperty("user.dir") +
				"\n vide.home = " + System.getProperty("vide.home"));*/
		
		baseDir = "..";//System.getProperty("vide.home") + java.io.File.separatorChar;
	}

	public static SplashScreen spl = new SplashScreen(new ImageIcon(vide.baseDir + "/res/images/splash.gif"));
	public static final String PROJECT_VERSION = "1.0 beta";
	public static String laf = "Metal";
	public static void main( String[] args ) {
		System.out.println("Starting vide...");
		vide.spl.showStatus("Starting...");

		JFrame frame;      
		frame = new VeriSimFrame();

		/*if ((args[1] == null) || (args[1].startsWith("metal")));
        else if (args[1].startsWith("motif")) laf = "com.sun.java.swing.plaf.windows.MotifLookAndFeel"; 
        else if (args[1].startsWith("windows")) laf = "com.sun.java.swing.plaf.windows.WindowsLookAndFeel";
        else  System.out.println("I never heard of this look and feel: " + args[1] + ".Using Metal.");
		 */
		try {
			//javax.swing.plaf.metal.MetalLookAndFeel.setCurrentTheme( new javax.swing.plaf.metal.DefaultMetalTheme());
			//  UIManager.setLookAndFeel(laf);
			//UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
			//UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");
			//UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");
			//UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");
			UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
		}
		catch ( UnsupportedLookAndFeelException e ) {
			System.out.println (laf + "Look & Feel not supported on this platform. \nProgram Terminated");
			System.exit(0);
		}
		catch ( IllegalAccessException e ) {
			System.out.println (laf + " Look & Feel could not be accessed. \nProgram Terminated");
			System.exit(0);
		}
		catch ( ClassNotFoundException e ) {
			System.out.println (laf + " Look & Feel could not found. \nProgram Terminated");
			System.exit(0);
		}
		catch ( InstantiationException e ) {
			System.out.println (laf + " Look & Feel could not be instantiated. \nProgram Terminated");
			System.exit(0);
		}
		catch ( Exception e ) {
			System.out.println ("Fatal error. \nProgram Terminated");
			e.printStackTrace();
			System.exit(0);
		}

		spl.toFront();
		spl.showStatus("Done.");
		spl.close();
		spl = null;

		frame.setVisible(true);
	}
}
